var auditswitch = document.getElementById("auditswitch").value;
if (auditswitch == 1) {
    document.getElementById("approval").checked = true;
    document.getElementById("noApproval").checked = false;
} else {
    document.getElementById("approval").checked = false;
    document.getElementById("noApproval").checked = true;
}
$("#approval").click(function(){
    document.getElementById("auditswitch").value=1;
});
$("#noApproval").click(function(){
    document.getElementById("auditswitch").value=2;
});

var lowestPriceBill = document.getElementById("lowestPriceBill").value;
if (lowestPriceBill == 1) {
    document.getElementById("nolpBill").checked = true;
    document.getElementById("lpBill").checked = false;
} else {
    document.getElementById("nolpBill").checked = false;
    document.getElementById("lpBill").checked = true;
}
$("#nolpBill").click(function(){
    document.getElementById("lowestPriceBill").value=1;
});
$("#lpBill").click(function(){
    document.getElementById("lowestPriceBill").value=2;
});
function auditSwitchSure() {
    var auditswitch = $("#auditswitch").val();
    var lowestPriceBill = $("#lowestPriceBill").val();
    var levelOneAudit = $("#levelOneAudit").val();//一级审核
    var levelTwoAudit = $("#levelTwoAudit").val();//二级审核
    if(levelOneAudit ==null || levelOneAudit==""){
        alert("请填写一级折扣比例");
        return;
    }
    if(levelTwoAudit ==null || levelTwoAudit==""){
        alert("请填写二级折扣比例");
        return;
    }
    var id = $("#id").val();
    $.ajax({
        url: Feng.ctxPath + "/dept/setauditswitch",
        type: "post",
        data: {
            id: id,
            auditswitch: auditswitch,
            lowestPriceBill: lowestPriceBill,
            levelOneAudit:levelOneAudit,
            levelTwoAudit:levelTwoAudit
        },
        success: function (data) {
            Feng.success('操作成功!');
            window.parent.Dept.table.refresh();
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
    })
}